import 'babel-polyfill'
import promise from 'es6-promise' // 兼容 Promise
import Vue from 'vue'
import VueRouter from 'vue-router'
promise.polyfill()

Vue.use(VueRouter)

const routes = [
  { path: '/', name: 'FaceLogin', component: () => import('./login.vue')},
  { path: '/personInfo', name: 'personInfo', component: () => import('./personInfo.vue')},
  { path: '/companyInfo', name: 'companyInfo', component: () => import('./companyInfo.vue')},
  { path: '/positionDetail', name: 'positionDetail', component: () => import('./positionDetail.vue')},
]

const router = new VueRouter({ routes })
router.beforeEach((to, from, next) => {
  if (!localStorage.getItem('facer_companyInfo') && to.path != '/') {
    window.location.href = '/facer.html'
    return
  }
  next()
})
export default router
